<?php
error_reporting(E_ALL & ~E_NOTICE);
require_once('../inc/Orders.php');
$order = array();
$order = $_POST;
SaveOrder($order);
if (isset($_POST['card_num'])) {
	require_once '../inc/anet_php_sdk/AuthorizeNet.php';
	$transaction = new AuthorizeNetAIM('5rXb4mC9UK', '74R4wv7Fz7LR7yJ9');

	$transaction -> amount = $_POST['price'];
	$transaction -> card_num = $_POST['card_num'];
	$transaction -> exp_date = $_POST['exp_date'];
	
}

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Home Page</title>
        <link rel="stylesheet" type="text/css" href="../inc/jquery-ui.css">
        <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
    </head>

    <body>
        <?
		include ('../inc/header.php');
        ?>
        <div class="container">
            <?
			include ('../inc/nav.php');
            ?>
            <pre>
                        <?
						if (isset($response)) {
							print_r($response);
						}
                        ?>
            </pre>                        
           


            <form action="?" method="post">
            	<h3>Billing Information</h3>
            	First Name:
                <input type="text" name="first_name" />
                <br />
                Last Name:
                <input type="text" name="last_name" />
                <br />
                Address:
                <input type="text" name="b_address" />
                <br />
                City:
                <input type="text" name="b_city" />
                <br />
                State:
                <input type="text" name="b_state" />
                <br />
                Zip Code:
                <input type="text" name="b_zip" />
                <br />
                <h3>Shipping Information</h3>
                Address:
                <input type="text" name="s_address" />
                <br />
                City:
                <input type="text" name="s_city" />
                <br />
                State:
                <input type="text" name="s_state" />
                <br />
                Zip Code:
                <input type="text" name="s_zip" />
                <br />
                <h3>Payment Method</h3>
                Price:
                <input type="number" name="price" />
                <br />
                Credit Card Number:
                <input type="text" name="card_num" />
                <br />
                Experation Date:
                <input type="text" name="ex_date" />
                <br />
                
                <input type="submit" value="Buy Now" />
            </form>
        </div>
        <div id="fb-root"></div>
        <script>
			( function(d, s, id) {
					var js, fjs = d.getElementsByTagName(s)[0];
					if (d.getElementById(id))
						return;
					js = d.createElement(s);
					js.id = id;
					js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
					fjs.parentNode.insertBefore(js, fjs);
				}(document, 'script', 'facebook-jssdk'));
        </script>
    </body>
</html>

